package com.thor.palmmall.rest.order.converter;

import java.util.ArrayList;
import java.util.List;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.order.AAmountActivities;
import com.thor.palmmall.spi.order.SAmountActivities;

public class AAmountActivitiesConverter
    implements Converter<List<SAmountActivities>, List<AAmountActivities>> {
  public static AAmountActivitiesConverter getInstance() {
    if (instance == null)
      instance = new AAmountActivitiesConverter();
    return instance;
  }

  private static AAmountActivitiesConverter instance;

  @Override
  public List<AAmountActivities> convert(List<SAmountActivities> sourceList) {
    if (sourceList == null || sourceList.size() == 0) {
      return null;
    }
    List<AAmountActivities> list = new ArrayList<AAmountActivities>();
    for (SAmountActivities source : sourceList) {
      AAmountActivities target = new AAmountActivities();

      target.setPromBillUuid(source.getPromBillUuid());
      target.setContract(source.getContract());
      target.setActivityName(source.getActivityName());
      target.setFullOrder(source.getFullOrder());

      list.add(target);
    }
    return list;
  }
}
